//*7:在给定的一个整数数组中（ 长度是20），要求查找第二大的数字是多少
package ZUOYE0423;

import java.util.Scanner;

public class 作业7 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int num[] = new int[20];
		System.out.println("输入20个数");
		int max = 0;
		for (int a = 0; a < num.length; a++) {
			num[a] = in.nextInt();
			if (max < num[a]) {
				max = num[a];
			}
		}
		System.out.println(max);
		int cha = max - num[0];
		int second = 0;
		for (int a1 = 0; a1 < num.length; a1++) {
			if ((cha > (max - num[a1])) && (max != num[a1])) {
				cha = max - num[a1];
				if (cha == 0)
					continue;
				second = num[a1];
			}
		}
		System.out.println("第二大的数字为" + second);
	}

}
